﻿// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");


var factory = new CharacterFactory();

// 模拟文档中有大量重复字符
var text = "AABBBCCCAAABBB";

foreach (var c in text)
{
  var character = factory.GetCharacter(c, "Arial");
  character.Draw(x: Random.Shared.Next(100), y: Random.Shared.Next(100));
}

Console.WriteLine($"\n总共创建了 {factory.Count} 个享元对象（而非 {text.Length} 个）");